<DOCTYPE HTML>
    <HTML lang=“en”>
    <head>
        <meat charset=utf-8/>
            <title>倒计时</title>
            <div id="myid"></div>
            <style>
                p {
                    position: relative;
                    font-size: 100px;
                    left: 35%;
                    top: 25%;
                }
                div {
                    position: relative;
                    font-size: 60px;
                    left: 34%;
                    top: 20%;
                }
            </style>
    </head>
    <boby>
        <p>元旦倒计时</p>
        <script>
            function time() {
                var myDate = new Date();
                var year = myDate.getFullYear();
                var month = myDate.getMonth();
                var day = myDate.getDate();
                var hour = myDate.getHours();
                var minute = myDate.getMinutes();
                var second = myDate.getSeconds();
                var m = 11 - month;
                var d = 31 - day;
                var h = 23 - hour;
                var mi = 59 - minute;
                var s = 60 - second;
                if (year % 400 === 0 || year % 4 === 0 && year % 100 != 0) {
                    c = 29;
                } else {
                    c = 28;
                }
                if (m === 0) {
                    b = 0;
                }
                if (m === 1) {
                    b = 30;
                }
                if (m === 2) {
                    b = 61;
                }
                if (m === 3) {
                    b = 91;
                }
                if (m === 4) {
                    b = 122;
                }
                if (m === 5) {
                    b = 153;
                }
                if (m === 6) {
                    b = 183;
                }
                if (m === 7) {
                    b = 214;
                }
                if (m === 8) {
                    b = 245;
                }
                if (m === 9) {
                    b = 275;
                }
                if (m === 10) {
                    b = 275 + c;
                }
                if (m === 11) {
                    b = 306 + c;
                }
                var e = b + d;
                a = e + "天" + h + "时" + mi + "分" + s + "秒";
            }
            setInterval(time,1000);
            function EverySecond() {
                const shu= document.body;
                const ye = document.createElement('div');
                ye.textContent =a;
                shu.appendChild(ye);
            }
            setInterval(EverySecond, 1000);
        </script>
    </boby>
    </html>
